<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>方案评估物资详情</title>
    <link rel="stylesheet" href="../WFRes/editor/themes/default/default.css" />
    <link rel="stylesheet" href="../WFRes/editor/plugins/code/prettify.css" />
    <link rel="stylesheet" href="/Portal/css/bootstrap.css?v=201904081636" type="text/css" />
    <link href="../WFRes/assets/stylesheets/bootstrap.min.css" rel="stylesheet"
          type="text/css" />
    <link href="../WFRes/assets/stylesheets/pixel-admin.min.css"  rel="stylesheet" type="text/css" />
    <link href="../WFRes/assets/stylesheets/themes.min.css" rel="stylesheet"
          type="text/css" />
    <link href="../WFRes/_Content/themes/ligerUI/Aqua/css/ligerui-all.css"
          rel="stylesheet" type="text/css" />
    <link href="../WFRes/css/MvcSheet.css?v=20180306123" rel="stylesheet" type="text/css" />
    <link href="../WFRes/css/MvcSheetPrint.css" rel="stylesheet"
          type="text/css" media="print" />
    <link rel="shortcut icon" type="image/x-icon"
          href="../WFRes/images/favicon.ico" media="screen" />


</head>
<body class="theme-default main-menu-animated grade-a platform-browser platform-win32 platform-ready" style="background-color: rgb(204, 204, 204);">
<div class="main-container container sheetContent" id="sheetContent" style="">
<div class="panel">
<div id="main-navbar" class="navbar navbar-inverse toolBar mainnavbar" role="navigation"  >
    <div class="navbar-inner">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-navbar-collapse">
                <i class="navbar-icon fa fa-bars"></i>
            </button>
        </div>
        <div id="main-navbar-collapse" class="navbar-collapse main-navbar-collapse collapse" style="display: block; height: 1px;">
            <ul class="nav navbar-nav SheetToolBar test" id="divTopBars">
                <li title="保存" data-action="Save"><a title="保存" href="javascript:void(0);" id ="save"><i title="保存" class="panel-title-icon fa fa-save toolImage"></i><span title="保存" class="toolText">保存</span></a></li>
                <li title="流程状态" data-action="ViewInstance"><a title="流程状态" onclick="openStatus()"><i title="流程状态" class="panel-title-icon fa fa-ellipsis-v toolImage"></i><span title="流程状态" class="toolText">流程状态</span></a></li>
                <li title="打印" data-action="Print"><a title="打印" href="javascript:void(0);" onclick="preview(); "><i title="打印" class="panel-title-icon fa fa-print toolImage"></i><span title="打印" class="toolText">打印</span></a></li>
                <li title="即同意，流程将继续流转" data-action="Submit"><a title="即同意，流程将继续流转" id="submit" href="javascript:void(0);"><i title="即同意，流程将继续流转" class="panel-title-icon fa fa-check toolImage"></i><span title="即同意，流程将继续流转" class="toolText">提交</span></a></li>
            </ul>
        </div>
    </div>
</div>


<!--<div id="main-navbar-collapse" class="collapse navbar-collapse main-navbar-collapse">
    <ul class="nav navbar-nav SheetToolBar test" id="divTopBars">
        &lt;!&ndash; <div id="cphMenu" >
                <li data-action="Submit">
                <a href="javascript:void(0);">
                <i class="panel-title-icon fa fa-check toolImage"></i> <span  class="toolText" data-en_us="Submit">提交</span>
                </a></li>
        </div> &ndash;&gt;

        <li title="保存" data-action="Save"><a title="保存" href="javascript:void(0);" id ="save"><i title="保存" class="panel-title-icon fa fa-save toolImage"></i><span title="保存" class="toolText">保存</span></a></li>
        <li title="流程状态" data-action="ViewInstance"><a title="流程状态" onclick="openStatus()"><i title="流程状态" class="panel-title-icon fa fa-ellipsis-v toolImage"></i><span title="流程状态" class="toolText">流程状态</span></a></li>
        <li title="打印" data-action="Print"><a title="打印" href="javascript:void(0);" onclick="preview(); "><i title="打印" class="panel-title-icon fa fa-print toolImage"></i><span title="打印" class="toolText">打印</span></a></li>
        <li title="即同意，流程将继续流转" data-action="Submit"><a title="即同意，流程将继续流转" id="submit" href="javascript:void(0);"><i title="即同意，流程将继续流转" class="panel-title-icon fa fa-check toolImage"></i><span title="即同意，流程将继续流转" class="toolText">提交</span></a></li>


    </ul>
</div>-->
    <div id="content-wrapper">
<div id="masterContent_divContent" class="div">
    <script type="text/javascript">

    </script>

    <div style="text-align: center;" class="DragContainer">
        <label id="lblTitle" class="panel-title">供应商方案评估表</label>
    </div>
    <div class="panel-body sheetContainer">
        <div class="nav-icon fa fa-chevron-right bannerTitle">
            <label id="divBasicInfo" data-en_us="Basic information">基本信息</label>
        </div>
        <div class="divContent">
            <div class="row">
                <div id="divFullNameTitle" class="col-md-2">
                    <label id="lblFullNameTitle" data-type="SheetLabel" data-datafield="Originator.UserName" data-en_us="Originator" data-bindtype="OnlyVisiable" style="">发起人</label>
                </div>
                <div id="divFullName" class="col-md-4">
                    <label id="lblFullName" data-type="SheetLabel" data-datafield="Originator.UserName" data-bindtype="OnlyData" style=""></label>
                </div>
                <div id="divOriginateDateTitle" class="col-md-2">
                    <label id="lblOriginateDateTitle" data-type="SheetLabel" data-datafield="OriginateTime" data-en_us="Originate Date" data-bindtype="OnlyVisiable" style="">发起时间</label>
                </div>
                <div id="divOriginateDate" class="col-md-4">
                    <label id="lblOriginateDate" data-type="SheetLabel" data-datafield="OriginateTime" data-bindtype="OnlyData" style=""></label>
                </div>
            </div>
            <div class="row">
                <div id="divOriginateOUNameTitle" class="col-md-2">
                    <label id="lblOriginateOUNameTitle" data-type="SheetLabel" data-datafield="Originator.OUName" data-en_us="Originate OUName" data-bindtype="OnlyVisiable" style="">所属组织</label>
                </div>
                <div id="divOriginateOUName" class="col-md-4">

                    <label data-datafield="Originator.OUName" data-type="SheetOriginatorUnit" id="ctlOriginaotrOUName" class="" style="">
                    </label>
                    <label data-datafield="Originator.OUName" data-type="SheetOriginatorUnit" id="ctlOriginaotrOUNameValue" class="" style="display:none">
                    </label>
                </div>
                <div id="divSequenceNoTitle" class="col-md-2">
                    <label id="lblSequenceNoTitle" data-type="SheetLabel" data-datafield="SequenceNo" data-en_us="SequenceNo" data-bindtype="OnlyVisiable" style="">流水号</label>
                </div>
                <div id="divSequenceNo" class="col-md-4">
                    <label id="lblSequenceNo" data-type="SheetLabel" data-datafield="SequenceNo" data-bindtype="OnlyData" style=""></label>
                </div>
            </div>


            <div class="row">
                <div id="projectNameTitle" class="col-md-2">
                    <label id="lblProjectNameTitle" data-type="SheetLabel"  data-en_us="Originator" data-bindtype="OnlyVisiable" style="">项目名称</label>
                </div>
                <div id="divprojectName" class="col-md-4">
                    <label id="lblprojectName" data-type="SheetLabel" data-datafield="Originator.UserName" data-bindtype="OnlyData" style=""></label>
                </div>
                <div id="divprojectCodeTitle" class="col-md-2">
                    <label id="lblprojectCodeTitle" data-type="SheetLabel" data-datafield="OriginateTime" data-en_us="Originate Date" data-bindtype="OnlyVisiable" style="">项目编码</label>
                </div>
                <div id="divProjectCode" class="col-md-4">
                    <label id="lblProjectCode" data-type="SheetLabel" data-datafield="OriginateTime" data-bindtype="OnlyData" style=""></label>
                </div>
            </div>


            <div class="row">
                <div id="parentProcessOrgTitle" class="col-md-2">
                    <label id="lblparentProcessOrgTitle" data-type="SheetLabel"  data-en_us="Originator" data-bindtype="OnlyVisiable" style="">项目组长</label>
                </div>
                <div id="divparentProcessOrgName" class="col-md-4">
                    <label id="lblparentProcessOrgName" data-type="SheetLabel" data-datafield="Originator.UserName" data-bindtype="OnlyData" style=""></label>
                </div>
                <div id="parentInstanceId" class="col-md-2">
                    <label id="parentInstanceIdTitle" data-type="SheetLabel"   style="">方案评估单</label>
                </div>
                <div id="parentInstanceIdV" class="col-md-4">
                    <a id="parentInstanceIdVal" target="_blank"></a>
                </div>
            </div>

        </div>

        <div class="nav-icon fa  fa-chevron-right bannerTitle">
            <label id="divSheetInfo" data-en_us="Sheet information">表单信息</label>
        </div>
        <div class="divContent" id="divSheet">
            <div id="tableContent" style="">


                <div class="row tableContent">
                    <div  class="col-md-2">
                        <span   style="">项目组长及评审团队</span>
                    </div>
                    <div   class="col-md-10">
                        <table  class="SheetGridView">
                            <tbody>
                            <tr class="header">
                                <td  >
                                    <label  >维度</label>
                                </td>
                                <td  >
                                    <label  >供应商1</label>
                                </td>
                                <td  >
                                    <label  >供应商2</label>
                                </td>
                                <td  >
                                    <label >供应商3</label>
                                </td>
                                <td  >
                                    <label  >供应商4</label>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

            </div>

            </div>
        </div>
    </div>
</div>
</div>
</div>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/jquery/jquery.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/jquery/ajaxfileupload.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/jquery/jquery.lang.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/ligerUI/ligerui.all.min.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/Calendar/WdatePicker.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/editor/kindeditor-all.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/editor/lang/zh_CN.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"js/Base64.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/MvcSheet/MvcSheet.js?v=201803281756\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/MvcSheet/SheetControls.js?v=201803211726\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/MvcSheet/MvcSheetUI.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/MvcSheet/Controls/SheetToolbar.js?v=20180306879\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
document.write("<script src=\"../WFRes/_Scripts/MVCRuntime/Sheet.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
    </script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/MVCRuntime/Sheet.Computation.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/MVCRuntime/Sheet.Display.js\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script type="text/javascript">
    document.write("<script src=\"../WFRes/_Scripts/MVCRuntime/Sheet.Validate.js?v=201803290978\" language=\"JavaScript\" charset=\"UTF-8\"><\/script>")
</script>
<script src="/Portal/WFRes/assets/javascripts/bootstrap.min.js?v=201901241136"></script>
<script>

    // data

    function preview() {
        body = window.document.body.innerHTML;
      /*  startpoint= "<!--startpoint-->";
        endpoint= "<!--endpoint-->";
        printdb= body.substring(body.indexOf(startpoint) + 17);
        printdb = printdb.substring(0, printdb.indexOf(endpoint));
        window.document.body.innerHTML = printdb ;*/
        window.print();
        window.document.body.innerHTML = body ;
    }

    var loadData = undefined;
    var loadDataContent = undefined;
    var processUrl = "/Portal/index.html#/InstanceDetail";

    function openStatus() {

        window.open(processUrl)
    }

    function getParam(paramName) {
        paramValue = "",
            isFound = !1;
        if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
            arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"),
                i = 0;
            while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0),
                i++
        }
        return paramValue == "" && (paramValue = null),
            paramValue
    }





    function OnLoad() {

        Mode = getParam("Mode");
        var WorkflowCode = getParam("WorkflowCode");
        var WorkflowVersion = getParam("WorkflowVersion");
        var WorkItemID = getParam("WorkItemID");
        var SchemaCode = getParam("SchemaCode");
        var BizObjectID = getParam("BizObjectID");
        var data = "";


        if (Mode == 'View') {
            $("#submit").hide();
            $("#save").hide();
        }

        if ((WorkItemID == "" || typeof (WorkItemID) == "undefined" || WorkItemID == null) && (SchemaCode == "" || typeof (SchemaCode) == "undefined" || SchemaCode == null)) {
            //发起流程的加载数据
            data = {
                "Mode": Mode,
                "WorkflowCode": WorkflowCode,
                "WorkflowVersion": WorkflowVersion,
                "SheetCode": "programevaluationmaterialsdetails",
                "SchemaCode": SchemaCode,
                "Command": "load",
                "Lang": "zh_cn"
            }
        } else if (SchemaCode != "" && typeof (SchemaCode) != "undefined" && SchemaCode != null) {
            //查询列表新增按钮后的加载数据
            $("#submit").hide();
            if (Mode == 'Originate') {
                data = {
                    "Mode": Mode,
                    "SheetCode": "programevaluationmaterialsdetails",
                    "SchemaCode": SchemaCode,
                    "Command": "load",
                    "Lang": "zh_cn"
                }
            } else {
                data = {
                    "Mode": Mode,
                    "SheetCode": "programevaluationmaterialsdetails",
                    "SchemaCode": SchemaCode,
                    "BizObjectID": BizObjectID,
                    "Command": "load",
                    "Lang": "zh_cn"
                }
            }
        } else if (WorkItemID != "" && typeof (WorkItemID) != "undefined" && WorkItemID != null) {
            //点击某个审批节点后的加载数据
            data = {
                "Mode": Mode,
                "WorkItemID": WorkItemID,
                "SheetCode": "programevaluationmaterialsdetails",
                "Command": "load",
                "Lang": "zh_cn"
            }
        }
        $.ajax({
            type: "GET",
            data: data,
            async: false,
            url: "/Portal/MvcDefaultSheet/OnLoad",
            dataType: "json",
            success: function (data) {
                loadData = data;
                processUrl = processUrl + "/" + data.InstanceId + "/" + data.WorkItemId + "//?WorkItemType=" + data.WorkItemType;

                $("#lblFullName").text(data.BizObject.DataItems["Originator.UserName"].V);

                $("#lblOriginateDate").text(data.BizObject.DataItems.CreatedTime.V);
                $("#lblSequenceNo").text(data.BizObject.DataItems.SequenceNo.V);

                $("#lblprojectName").text(data.BizObject.DataItems.projectName.V);
                $("#lblProjectCode").text(data.BizObject.DataItems.projectCode.V);

                $("#lblparentProcessOrgName").text(data.BizObject.DataItems.parentProcessOrg.V);
                if(data.BizObject.DataItems.parentInstanceId!=undefined && data.BizObject.DataItems.parentInstanceId!=null) {
                    $("#parentInstanceIdVal").text("方案评估");
                    $("#parentInstanceIdVal").attr("href", "/Portal/InstanceSheets.html?InstanceId=" + data.BizObject.DataItems.parentInstanceId.V);
                }
                for(var k in data.DirectParentUnits)
                {
                    $("#ctlOriginaotrOUName").text(data.DirectParentUnits[k]);
                    $("#ctlOriginaotrOUNameValue").text(k);
                }

                if (Mode != 'Originate' &&  !((Mode == 'Work' && loadData.ActivityCode == "Activity2")) ) {

                   var tableParentDiv = $("#tableContent");
                   if(data.BizObject.DataItems.content.V.length>0){
                       var schemeEvaluationDataTables   =  data.BizObject.DataItems.content.V;
                       var base = new Base64();
                       var decodeData = base.decode(data.BizObject.DataItems.content.V);
                       schemeEvaluationDataTables = eval(decodeData);
                       loadDataContent=schemeEvaluationDataTables;
                       var tableStartString ='';
                   var tableEndString ='</tbody></table></div></div>';
                   if(schemeEvaluationDataTables==undefined){
                       return ;
                   }
                       for(var i=0;i<schemeEvaluationDataTables.length;i++){
                             tableStartString+= '<div class="row tableContent"><div  class="col-md-2"><span   style="">'+schemeEvaluationDataTables[i].subjectName+'</span></div><div   class="col-md-10"><table  class="SheetGridView"  data-objid="'+schemeEvaluationDataTables[i].tableID+'" style="text-align:center;"><tbody><tr class="header"><td  ><label  >维度</label></td><td  ><label  >'+schemeEvaluationDataTables[i].supplierA+'</label></td><td  ><label  >'+schemeEvaluationDataTables[i].supplierB+'</label></td><td  ><label >'+schemeEvaluationDataTables[i].supplierC+'</label></td><td  ><label  >'+schemeEvaluationDataTables[i].supplierD+'</label></td></tr>';
                           var tableData = schemeEvaluationDataTables[i].subjectTable;
                          var a= schemeEvaluationDataTables[i].supplierA;
                           var b= schemeEvaluationDataTables[i].supplierB;
                           var c= schemeEvaluationDataTables[i].supplierC;
                           var d= schemeEvaluationDataTables[i].supplierD;
                           for(var j =0 ;j<tableData.length; j++){
                               var a1=a+'-'+tableData[j].dimension;
                               var b1=b+'-'+tableData[j].dimension;
                               var  c1=c+'-'+tableData[j].dimension;
                               var d1=d+'-'+tableData[j].dimension;
                               if(tableData[j][a1]==undefined){
                                   tableData[j][a1]="";
                               }
                               if(tableData[j][b1]==undefined){
                                   tableData[j][b1]="";
                               }
                               if(tableData[j][c1]==undefined){
                                   tableData[j][c1]="";
                               }
                               if(tableData[j][d1]==undefined){
                                   tableData[j][d1]="";
                               }
                               tableStartString+='<tr><td style="width:20%;">'+tableData[j].dimension+'</td><td style="width:20%;"> '+tableData[j][a1]+' </td><td style="width:20%;">  '+tableData[j][b1]+ ' </td><td style="width:20%;">  '+tableData[j][c1]+ ' </td><td style="width:20%;">   '+tableData[j][d1]+  '  </td></tr>';
                           }
                           tableStartString+=tableEndString;
                       }
                       tableParentDiv.html(tableStartString);
                   }
                } else  {
                    var tableParentDiv = $("#tableContent");
                    if(data.BizObject.DataItems.content.V.length>0){
                        var schemeEvaluationDataTables   =  data.BizObject.DataItems.content.V;
                        var base = new Base64();
                        var decodeData = base.decode(data.BizObject.DataItems.content.V);
                        schemeEvaluationDataTables = eval(decodeData);
                        debugger;
                        loadDataContent=schemeEvaluationDataTables;
                        var tableStartString ='';
                        var tableEndString ='</tbody></table></div></div>';
                        if(schemeEvaluationDataTables==undefined){
                            return ;
                        }
                        for(var i=0;i<schemeEvaluationDataTables.length;i++){
                            tableStartString+= '<div class="row tableContent"><div  class="col-md-2"><span   style="">'+schemeEvaluationDataTables[i].subjectName+'</span></div><div   class="col-md-10"><table  class="SheetGridView"  data-objid="'+schemeEvaluationDataTables[i].tableID+'" style="text-align:center;"><tbody><tr class="header"><td  style="width:20%;" ><label  >维度</label></td><td  style="width:20%;" ><label  >'+schemeEvaluationDataTables[i].supplierA+'</label></td><td  style="width:20%;" ><label  >'+schemeEvaluationDataTables[i].supplierB+'</label></td><td style="width:20%;" ><label >'+schemeEvaluationDataTables[i].supplierC+'</label></td><td style="width:20%;"  ><label  >'+schemeEvaluationDataTables[i].supplierD+'</label></td></tr>';
                            var tableData = schemeEvaluationDataTables[i].subjectTable;
                            var a= schemeEvaluationDataTables[i].supplierA;
                            var b= schemeEvaluationDataTables[i].supplierB;
                            var c= schemeEvaluationDataTables[i].supplierC;
                            var d= schemeEvaluationDataTables[i].supplierD;
                            for(var j =0 ;j<tableData.length; j++){
                                var a1=a+'-'+tableData[j].dimension;
                                var b1=b+'-'+tableData[j].dimension;
                                var  c1=c+'-'+tableData[j].dimension;
                                var d1=d+'-'+tableData[j].dimension;
                                if(tableData[j][a1]==undefined){
                                    tableData[j][a1]="";
                                }
                                if(tableData[j][b1]==undefined){
                                    tableData[j][b1]="";
                                }
                                if(tableData[j][c1]==undefined){
                                    tableData[j][c1]="";
                                }
                                if(tableData[j][d1]==undefined){
                                    tableData[j][d1]="";
                                }
                                tableStartString+='<tr><td style="width:20%;">'+tableData[j].dimension+'</td><td style="width:20%;"><textarea>'+tableData[j][a1]+'</textarea></td><td style="width:20%;"><textarea> '+tableData[j][b1]+ '</textarea></td><td style="width:20%;"> <textarea>'+tableData[j][c1]+ '</textarea></td><td style="width:20%;"><textarea>  '+tableData[j][d1]+  '</textarea> </td></tr>';
                            }
                            tableStartString+=tableEndString;
                        }
                        tableParentDiv.html(tableStartString);
                    }
                }
            }
        });


    }


    $(document).ready(function () {
        var Mode = getParam("Mode");
        OnLoad();
        if ((Mode == 'Originate' || (Mode == 'Work' && loadData.ActivityCode == "Activity2")) && Mode != 'View') {

        } else if (((Mode != 'Originate' && loadData.ActivityCode != "Activity2") || Mode == 'View' || (Mode == 'Work' && loadData.ActivityCode != "Activity2"))) {
            //否则加载之前保存的数据
            OnLoad();

        }

    })


     


    function OnLoadSave() {

        var Mode = getParam("Mode");
        var WorkflowCode = getParam("WorkflowCode");
        var WorkflowVersion = getParam("WorkflowVersion");
        var WorkItemID = getParam("WorkItemID");
        var SchemaCode = getParam("SchemaCode");
        var urlParam = "";
        if (WorkItemID == "" || typeof (WorkItemID) == "undefined" || WorkItemID == null) {
            urlParam = "&WorkflowCode=" + WorkflowCode + "&WorkflowVersion=" + WorkflowVersion;
        } else {
            urlParam = "&WorkItemID=" + WorkItemID
        }

        if ((WorkItemID == "" || typeof (WorkItemID) == "undefined" || WorkItemID == null) && (SchemaCode == "" || typeof (SchemaCode) == "undefined" || SchemaCode == null)) {
            //发起流程的加载是数据
            urlParam = "&WorkflowCode=" + WorkflowCode + "&WorkflowVersion=" + WorkflowVersion;
        } else if (SchemaCode != "" && typeof (SchemaCode) != "undefined" && SchemaCode != null) {
            //查询列表新增按钮后的加载是数据
            urlParam = "&SchemaCode=" + SchemaCode;
        } else if (WorkItemID != "" && typeof (WorkItemID) != "undefined" && WorkItemID != null) {
            //点击某个审批节点后的加载是数据
            urlParam = "&WorkItemID=" + WorkItemID
        }



        $.ajax({
            type: "POST",
            data: {
                "Command": "Save",
                MvcPostValue: JSON.stringify({
                    "Command": "Save",
                    "BizObjectId": loadData.BizObjectID,
                    "InstanceId": loadData.InstanceId,
                    "BizObject": getData(),
                    "ParentUnitID": loadData.OriginatorOU,
                    "HiddenFields": {},
                    "Priority": "Unspecified",
                })
            },
            async: false,
            url: "/Portal/MvcDefaultSheet/OnLoad?Mode=" + Mode + urlParam + "&SheetCode=InventoryManagement&Command=Save&BizObjectID=" + loadData.BizObjectID,
            dataType: "json",
            success: function (data) {
                debugger;
                console.log(data);
                window.location.reload();
                window.close();
                top.window.postMessage("ClosePage", "*");
                window.history.go(-1);
            }
        });
    }


    function getData() {

    $(".SheetGridView").each(function(){

       var  tbId=$(this).data("objid");
       var thisTable = $(this);
       var  arraytable = [];
        $(this).find("tbody").find("tr").each(function(index){

            if(index>0) {

                //取每列的供应商用"-"拼接每行的维度
                var key1 = $(thisTable.find("tr")[0]).find("td").eq(1).find("label").text()+'-'+$(this).find("td").eq(0).text();
                $(this).find("td").eq(1).find("textarea").val();

                var key2 = $(thisTable.find("tr")[0]).find("td").eq(2).find("label").text()+'-'+$(this).find("td").eq(0).text();
                $(this).find("td").eq(2).find("textarea").val();

                var key3 = $(thisTable.find("tr")[0]).find("td").eq(3).find("label").text()+'-'+$(this).find("td").eq(0).text();
                $(this).find("td").eq(3).find("textarea").val();

                var key4 = $(thisTable.find("tr")[0]).find("td").eq(4).find("label").text()+'-'+$(this).find("td").eq(0).text();
                $(this).find("td").eq(4).find("textarea").val();
                var jsond={};
                jsond[key1]=$(this).find("td").eq(1).find("textarea").val();
                jsond[key2]=$(this).find("td").eq(2).find("textarea").val();
                jsond[key3]=$(this).find("td").eq(3).find("textarea").val();
                jsond[key4]=$(this).find("td").eq(4).find("textarea").val();
                arraytable.push(jsond);
            }
        })
        console.log(arraytable)
        if(loadDataContent==undefined || loadDataContent.length<1){
            return null;
        }
       for(var i=0;i<loadDataContent.length;i++){

              if(tbId==loadDataContent[i].tableID){

                  var a=loadDataContent[i].supplierA;
                  var b=loadDataContent[i].supplierB;
                  var c=loadDataContent[i].supplierC;
                  var d=loadDataContent[i].supplierD;

                  for(var j=0;j<loadDataContent[i].subjectTable.length;j++){
                     var a1=a+'-'+loadDataContent[i].subjectTable[j].dimension;
                      var b1=b+'-'+loadDataContent[i].subjectTable[j].dimension;
                      var c1=c+'-'+loadDataContent[i].subjectTable[j].dimension;
                      var d1=d+'-'+loadDataContent[i].subjectTable[j].dimension;
                       for(var k=0;k<arraytable.length;k++){
                           for(var key in arraytable[k]){
                               if(key == a1){
                                   loadDataContent[i].subjectTable[j][a1]=arraytable[k][a1];
                               }
                               if(key == b1){
                                   loadDataContent[i].subjectTable[j][b1]=arraytable[k][b1];
                               }
                               if(key == c1){
                                   loadDataContent[i].subjectTable[j][c1]=arraytable[k][c1];
                               }
                               if(key == d1){
                                   loadDataContent[i].subjectTable[j][d1]=arraytable[k][d1];
                               }
                           }

                       }

                  }


              }
       }


    })
        console.log(loadDataContent)

        var base = new Base64();
        if(loadDataContent!=undefined ){

       var dataEncode= base.encode(JSON.stringify(loadDataContent));

        }
       var jsonData ="";
      if(loadData.BizObject.DataItems.ObjectID.V == null || loadData.BizObject.DataItems.ObjectID.V =="" || loadData.BizObject.DataItems.ObjectID.V ==undefined) {
            jsonData = {
              "DataItems":
                  {
                      "content":
                          {
                              "L":
                                  5, "N":
                                  "物资详情",
                              "O": "VEM",
                              "V": dataEncode,
                              "RowNum": 0
                          }
                  }

          };
      }else{
            jsonData = {
              "DataItems":
                  {
                      "content":
                          {
                              "L":
                                  5, "N":
                                  "物资详情",
                              "O": "VEM",
                              "V": dataEncode,
                              "RowNum": 0
                          },
                          "ObjectID":{
                              "L":
                                  6, "N":
                                  "",
                              "O": "VEM",
                              "V": loadData.BizObject.DataItems.ObjectID.V,
                              "RowNum":1
                          },
                      "projectLeaderTrue":{
                          "L":
                              6, "N":
                              "项目组长",
                          "O": "VEM",
                          "V": loadData.BizObject.DataItems.projectLeaderTrue.V.Code,
                          "RowNum":2
                      },
                      "projectName":{
                          "L":
                              6, "N":
                              "项目名称",
                          "O": "VEM",
                          "V": loadData.BizObject.DataItems.projectName.V,
                          "RowNum":2
                      },
                      "projectCode":{
                          "L":
                              6, "N":
                              "项目编号",
                          "O": "VEM",
                          "V": loadData.BizObject.DataItems.projectCode.V,
                          "RowNum":2
                      },
                      "parentProcessOrg":{
                          "L":
                              6, "N":
                              "父流程发起人",
                          "O": "VEM",
                          "V": loadData.BizObject.DataItems.parentProcessOrg.V,
                          "RowNum":2
                      }
                  }

          };
      }
        console.log(jsonData)
        return jsonData;
    }

    function OnLoadSubmit() {

        var Mode = getParam("Mode");
        var WorkflowCode = getParam("WorkflowCode");
        var WorkflowVersion = getParam("WorkflowVersion");
        var WorkItemID = getParam("WorkItemID");
        var SchemaCode = getParam("SchemaCode");
        var urlParam = "";
        if (WorkItemID == "" || typeof (WorkItemID) == "undefined" || WorkItemID == null) {
            urlParam = "&WorkflowCode=" + WorkflowCode + "&WorkflowVersion=" + WorkflowVersion;
        } else {
            urlParam = "&WorkItemID=" + WorkItemID
        }

        if ((WorkItemID == "" || typeof (WorkItemID) == "undefined" || WorkItemID == null) && (SchemaCode == "" || typeof (SchemaCode) == "undefined" || SchemaCode == null)) {
            //发起流程的加载是数据
            urlParam = "&WorkflowCode=" + WorkflowCode + "&WorkflowVersion=" + WorkflowVersion;
        } else if (SchemaCode != "" && typeof (SchemaCode) != "undefined" && SchemaCode != null) {
            //查询列表新增按钮后的加载是数据
            urlParam = "&SchemaCode=" + SchemaCode;
        } else if (WorkItemID != "" && typeof (WorkItemID) != "undefined" && WorkItemID != null) {
            //点击某个审批节点后的加载是数据
            urlParam = "&WorkItemID=" + WorkItemID
        }
        var subData = getData("submit");
        if (subData == false) {
            return false;
        }

        $.ajax({
            type: "POST",
            data: {
                "Command": "Submit",
                MvcPostValue: JSON.stringify({
                    "Command": "Submit",
                    "BizObjectId": loadData.BizObjectID,
                    "InstanceId": loadData.InstanceId,
                    "BizObject": getData(),
                    "ParentUnitID": loadData.OriginatorOU,
                    "HiddenFields": {},
                    "Priority": "Unspecified",
                })
            },
            async: false,
            url: "/Portal/MvcDefaultSheet/OnLoad?Mode=" + Mode + urlParam + "&SheetCode=InventoryManagement&Command=Submit&BizObjectID=" + loadData.BizObjectID,
            dataType: "json",
            success: function (data) {
                debugger;
                console.log(data);
                window.location.reload();
                window.close();
                top.window.postMessage("ClosePage", "*");
                window.history.go(-1);
            }
        });
    }

    $(function () {
        $(".collapse").show();
            $("#save").click(function () {
                OnLoadSave();

            })
            $("#close").click(function () {
                window.opener.location.reload();
                window.close();
                top.window.postMessage("ClosePage", "*");
                window.history.go(-1);
            })
            $("#submit").click(function () {
                if (confirm('确定是否提交？')) {
                    OnLoadSubmit();
                }
            })

        }
    )

</script>


<script type="text/javascript">


    $(function () {
        var w = 12;//$("textarea[data-richtextbox]").length > 0 ? 12 : 0;
        $(window).resize(
            function () {


                $("#main-navbar").css("width",
                    $("#main-navbar").parent().width() - w);
                //表单按钮展示超出一行的加下拉按钮并隐藏
                var topBarWidth = 0;
                var topBarFlag = true;
                //获取所有按钮的总宽
                $("#divTopBars").children("li").each(function () {
                    topBarWidth += ($(this).width() + 1);
                })

                if (topBarWidth > ($("#main-navbar").width() - 20) && ($("#divTopBars").children("li").width() + 1) != ($("#main-navbar").width() - 20)) {
                    $("#divTopBars").css({
                        "height": $("#divTopBars").children("li").height(),
                        "overflow": "hidden",
                        "padding-right": "20px"
                    });
                    $("#divTopBars").after("<i class='glyphicon glyphicon-chevron-down' id='dropTopBars' style='position:absolute;right:3px;top:15px;color:dodgerblue;font-size:16px;'></i>");

                    $("#divTopBars").on("click", function (event) {
                        // alert('111')
                        if (event.target.nodeName == "UL") {
                            if (topBarFlag) {
                                topBarFlag = false;
                                $("#divTopBars").css({"height": "inherit", "overflow": "inherit"});
                                $("i#dropTopBars").addClass("glyphicon-chevron-up").removeClass("glyphicon-chevron-down");
                            } else {
                                topBarFlag = true;
                                $("#divTopBars").css({
                                    "height": $("#divTopBars").children("li").height(),
                                    "overflow": "hidden"
                                });
                                $("i#dropTopBars").addClass("glyphicon-chevron-down").removeClass("glyphicon-chevron-up");
                            }
                        }
                    });
                } else {
                    $("i#dropTopBars").hide();
                }
            });
        $("#main-navbar").css("width", $("#main-navbar").parent().width() - w);
    })


    $(function(){
        $("div").css({"font-size":"16px"});
    })



</script>

</body>
</html>

